<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>{{msg}}</h1>
        <p>我叫{{obj.name}},今年{{obj.age}}岁</p>
        <button @click = "onClick">修改ref数据</button>
    </div>
    <script src = "https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
        const {createApp, ref} = Vue
        createApp({
            setup() {
                const msg = ref("Hello World!")
                const obj = ref({
                    name: "Vue",
                    age: 10
                })
                const onClick = () => {
                    msg.value = "hello Vue3!"
                    obj.value.name = "Vue3"
                    obj.value.age = 19
                }
                return {
                    msg,
                    obj,
                    onClick
                }
            }
        }).mount('#app')
    </script>
</body>
</html>